<!--
 * @Author: ljc
 * @Date: 2023-04-23 18:08:33
 * @LastEditors: g05047
 * @LastEditTime: 2023-10-27 16:21:11
 * @Description: 财评报告上传
-->
<template>
  <RkContainer :isFooter="false"
    :isAside="false"
    :isHeader="false">
    <template #main>
      <rk-center>
        <template #condition>
        </template>
        <template #content>
          <rk-grid ref="finacialRef"
            title="财评报告上传"
            dataUrl="/proAltApply/queryProjectList"
            :boxConfig="false"
            :params="queryParams"
            :columns="tableColumns">
            <template #toolbar_title_buttons>
              <el-form-item label="单位"
                style="margin: 0 10px">
                <rk-select style="width: 80px;height: 30px"
                  :isSearch="false"
                  :options="toArray(COMMON_AMOUNT_UNIT)"
                  v-model="queryParams.dw"
                  @change="handleSearch"></rk-select>
              </el-form-item>
              <el-input v-model="queryParams.mhcx"
                placeholder="请输入名称/编码"
                class="mr-15px w-200px"
                clearable
                @input="handleSearch">
              </el-input>
            </template>
            <template #opreation="{ row }">
              <el-button type="primary"
                size="small"
                @click="handleUpload(row)">文件上传</el-button>
            </template>
          </rk-grid>
        </template>
      </rk-center>
    </template>
    <UploadProjDialog ref="uploadProjDialogRef"
      type="finance"
      :formCode="$route.query.formCode">
    </UploadProjDialog>
  </RkContainer>

</template>
<script setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import { COMMON_AMOUNT_UNIT, toArray } from '@/enums/enums-common.js'
import { UploadProjDialog } from "@/components/dialog/index.js"

// ----- 路由相关操作
const route = useRoute()
const query = route.query
// 查询参数
const queryParams = reactive({
  agencyType: 0,
  mhcx: undefined,
  dw: 2,
  nodeId: query.nodeId
})
const finacialRef = ref('')
const tableColumns = ref([
  { field: 'agencyName', title: '申报单位', width: 200, align: 'left', headerAlign: 'center' },
  {
    field: 'proName',
    title: '项目名称',
    width: 250,
    align: 'left',
    // 关键代码
    cellRender: { name: 'fdXmYHS' }
  },
  { field: 'proCode', title: '项目编码', align: 'left', width: 200, headerAlign: 'center' },
  {
    field: 'isDeptApprove', title: '主管部门是否审批', width: 200, align: 'center',
    formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  {
    field: 'isEia', title: '是否完成环评工作', width: 200, align: 'center', formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  {
    field: 'isSecurityAsmt', title: '是否完成安评工作', width: 200, align: 'center', formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  {
    field: 'isBId', title: '是否完成招投标工作', width: 200, align: 'center', formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  {
    field: 'isLehr', title: '是否完成征地拆迁等相关工作', width: 250, align: 'center', formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  {
    field: 'isHaveLuc', title: '是否取得《国有土地使用证》', width: 250, align: 'center', formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  {
    field: 'isHavePp', title: '是否取得《建设用地规划使用证》', width: 250, align: 'center', formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  {
    field: 'isHavelup', title: '是否取得《建设工程规划使用证》', width: 250, align: 'center', formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  {
    field: 'isHaveCp', title: '是否取得《建设工程施工许可证》', width: 250, align: 'center', formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  {
    field: 'isHaveExEval', title: '实施方案中是否事前绩效评估内容', width: 250, align: 'center', formatter: ['enumsFormats', 'WHETHER_ENUMS']
  },
  { field: 'applyDate', title: '年度', width: 120, align: 'center' },
  { field: 'debtDeadlineName', title: '债券期限', width: 130, align: 'center' },
  { field: 'applyAmt', title: '申请金额', width: 150, align: 'right', formatter: 'formatThousand' },
  { field: 'proCapital', title: '项目资本金', width: 150, align: 'right', formatter: 'formatThousand' },
  { field: 'bondTypeName', title: '申请类型', width: 150, align: 'center' },
  { field: 'setupYear', title: '立项年度', width: 100, align: 'center' },
  { field: 'proTypeName', title: '项目类型', width: 150, align: 'left' },
  { field: 'fundInvestAreaName', title: '资金投向领域', width: 200, align: 'left' },
  { field: 'totalBudget', title: '项目总概算', width: 150, align: 'right', formatter: 'formatThousand' },
  { field: 'startDate', title: '开工日期', width: 120, align: 'center' },
  { field: 'endDate', title: '竣工日期', width: 120, align: 'center' },
  { field: 'proStatusName', title: '建设状态', width: 120, align: 'left' },
  { field: 'ndrcProCode', title: '发改委审批监管代码', width: 250, align: 'left' },
  {
    field: 'opreation', title: '操作', width: 100, align: 'center', fixed: 'right', slots: { default: 'opreation' }
  },
])
/**查询 */
const handleSearch = () => {
  finacialRef.value.searchEvent()
}
/**上传 */
const uploadProjDialogRef = ref()
const handleUpload = (selectRow) => {
  if (selectRow) {
    const { proId, applyId, ruleId } = selectRow
    uploadProjDialogRef.value.handleOpen({ proId, applyId, ruleId })
  } else {
    ElMessage.warning('请选择一条数据进行操作！')
  }
}
</script>
<style lang="scss" scoped>
.mr-15px {
	margin-right: 15px;
	&:last-child {
		margin-right: 0;
	}
}
.w-200px {
	width: 200px;
}
</style>
  